pacman::p_load(RColorBrewer,ggplot2,Rtsne,dplyr,magrittr)
setwd("E:/projects/R_draw_sc/test/tsne/data")

set.seed(20)
d1 <- read.delim("genes.fpkm.txt",check.names=FALSE,row.names=1) %>% head(n=150) %>%unique() %>% as.matrix()


#iris_unique <- unique(iris) # Remove duplicates
#iris_matrix <- as.matrix(iris_unique[,1:4])
#
#set.seed(42)
#tsne_out <- Rtsne(iris_matrix,pca=FALSE,perplexity=30,theta=0.0) # Run TSNE
#plot(tsne_out$Y,col=iris_unique$Species, asp=1)

d2 <-Rtsne(d1,pca = FALSE,perplexity = 30,theta=0.0)
data <- data.frame(d2$Y)
colnames(data) <- c("x","y")
ggplot(data) + geom_point(aes(x=x,y=y))
